﻿using Joy.Erp.BasicArchives;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;

namespace Joy.Erp.Ufida.Pmc
{
    [RemoteService(Name = BasicArchivesRemoteServiceConsts.RemoteServiceName)]
    [Area(BasicArchivesRemoteServiceConsts.ModuleName)]
    [ControllerName("ProductionPlatform")]
    [Route("api/basic-archives/production-platform")]
    public class ProductionPlatformController : BasicArchivesController, IProductionPlatformAppService
    {
        protected IProductionPlatformAppService ProductionPlatformAppService => LazyServiceProvider.LazyGetRequiredService<IProductionPlatformAppService>();

        /// <summary>
        /// 获取需求订单分页列表
        /// </summary>
        [HttpGet]
        [Route("get-list")]
        public Task<PagedResultDto<DemandOrderDto>> GetListAsync(GetDemandOrderPagedInput input)
        {
            return ProductionPlatformAppService.GetListAsync(input);
        }

        /// <summary>
        /// 更新单个需求订单
        /// </summary>
        [HttpPut]
        [Route("update-demand-order")]
        public Task<bool> UpdateDemandOrderAsync(UpdateDemandOrderInput input)
        {
            return ProductionPlatformAppService.UpdateDemandOrderAsync(input);
        }

        /// <summary>
        /// 齐套分析
        /// </summary>
        [HttpPost]
        [Route("kit-analysis")]
        public Task<List<DemandOrderDto>> KitAnalysisAsync(KitInput input)
        {
            return ProductionPlatformAppService.KitAnalysisAsync(input);
        }

        /// <summary>
        /// 清除缓存
        /// </summary>
        [HttpDelete]
        [Route("clear-cache")]
        public Task ClearCacheAsync()
        {
            return ProductionPlatformAppService.ClearCacheAsync();
        }
    }
}
